home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Jumpstart / Multimedia Microsoft Jumpstart Version 1.1a (Microsoft).BIN / develpmt / drivers / mscdex / testdrv / test.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-25  |  4.2 KB  |  167 lines

  1. /*
  2. ** TESTDRV
  3. **
  4. ** Device Driver Test for MSCDEX compatible CD-ROM
  5. **
  6. ** FILE: test.h
  7. **
  8. ** 
  9. ** HISTORY:
  10. **    10/01/90  Final (v1.0) -by- JYG
  11. */
  12.  
  13. // Header File Sourcing
  14.  
  15. #include<stdlib.h>
  16. #include<stdio.h>
  17. #include<conio.h>
  18. #include<ctype.h>
  19. #include<dos.h>
  20. #include<memory.h>
  21. #include<string.h>
  22.  
  23. // Basic types
  24.  
  25. typedef unsigned char   uchar;
  26. typedef unsigned short  ushort;
  27. typedef unsigned int    uint;
  28. typedef unsigned long   ulong;
  29.  
  30. typedef unsigned char   BYTE;
  31. typedef unsigned short  WORD;
  32. typedef unsigned long   DWORD;
  33. typedef char FLAG;
  34.  
  35. // Macros for building/taking apart long's
  36.  
  37. #define MAKELONG(lo, hi)  ((long)(((unsigned)(lo)) | ((unsigned long)((unsigned)(hi))) << 16))
  38. #define LOWORD(l)   ((WORD)(DWORD)(l))
  39. #define HIWORD(l)   ((WORD)(((DWORD)(l) >> 16) & 0xffff))
  40. #define LOBYTE(w)   ((BYTE)(w))
  41. #define HIBYTE(w)   (((WORD)(w) >> 8) & 0xff)
  42.  
  43. #define TRUE            (0==0)
  44. #define FALSE           (0!=0)
  45. #define UNSET           (-1)
  46.  
  47. /*   ***  Device header structure definition  *** */
  48.  
  49. #define SIGFIELD               "MSCD00"
  50.  
  51. /* Format for CDROM device driver header at CS:0 of device driver
  52. ** Slightly extended from standard MSDOS character device driver
  53. */
  54.  
  55. #define PROGNAME    "TESTDRV"
  56.  
  57. // Read/Write Mode
  58.  
  59. #define COOKED_MODE     0x00
  60. #define RAW_MODE        0x01
  61.  
  62. // Addressing Modes
  63.  
  64. #define HSG_ADDRMODE        0x00
  65. #define REDBOOK_ADDRMODE    0x01
  66.  
  67. // Status word masks
  68.  
  69. #define DONEBIT         0x0100   //DONE if Bit 8 is set
  70. #define ERRORBIT        0x8000   //Error if Bit 15 is set
  71. #define BUSYBIT         0x0200   //BUSY if Bit 9
  72. #define ERRORMASK       0x00FF   //Lower 8 bits 
  73. #define UNKNOWN_CMD     0x8003
  74. #define SEC_INIT_ERR    0x0003   //Second time INIT error
  75.  
  76. // DevStatus selector masks
  77.  
  78. #define DEVSTAT_DROPEN      0x00000001
  79. #define DEVSTAT_DRLOCK      0x00000002
  80. #define DEVSTAT_RAW         0x00000004
  81. #define DEVSTAT_WRITE       0x00000008
  82. #define DEVSTAT_AUDVID      0x00000010
  83. #define DEVSTAT_INTERLEAVE  0x00000020
  84. // RESERVED                 0x00000040
  85. #define DEVSTAT_PREFETCH    0x00000080
  86. #define DEVSTAT_AUDCTRL     0x00000100
  87. #define DEVSTAT_REDBOOK     0x00000200
  88. // RESERVED                 0x00000400
  89. #define DEVSTAT_NODISK      0x00000800
  90. #define DEVSTAT_SUBINFO     0x00001000
  91.  
  92. #define LOCK_DOOR           0x01
  93. #define UNLOCK_DOOR         0x00
  94.  
  95. #define RAW_SECTOR_SIZE     2352
  96. #define COOKED_SECTOR_SIZE  2048
  97.  
  98. #define AUDIO_PAUSEDBIT     0x0001
  99. #define SECTOR_NOT_FND      0x0008
  100. #define DRV_NOT_READY       0x0002
  101.  
  102. //
  103. // Request name structure
  104. //
  105.  
  106. typedef struct _ReqName {
  107.     BYTE bCmd,bSubCmd;
  108.     char * CmdName;
  109. } ReqName;
  110.  
  111. //
  112. // Enumerated types for accessing tests and request structures
  113. //
  114.  
  115. enum test {tINIT=0,tDEVSTAT,tRADDR,tRESET,tLOCKDOOR,tDRVBYTES,tRESERVEDCMD,
  116.     tSECTORSIZE,tUPCCODE,tVOLSIZE,tEJECT,tAUDIODISK,tSECTORDUMP,tTESTCONTROL};
  117.  
  118. enum request {rINIT=0,rIRADDR,rILOCHEAD,rIERRSTAT,rIAUDINFO,rIDRVBYTES,
  119.     rIDEVSTAT,rISECTSIZE,rIVOLSIZE,rIMEDCHNG,rIDISKINFO,rITNOINFO,rIQINFO,
  120.     rISUBINFO,rIUPCCODE,rIAUDSTAT,rOEJECT,rOLOCKDOOR,rORESET,rOAUDINFO,
  121.     rODRVBYTES,rOCLOSETRAY,rREADL,rREADLPRE,rSEEK,rPLAY,rSTOP,rRESUME,rWRITE,
  122.     rWRITELV,rFLUSHI,rFLUSHO,rDOPEN,rDCLOSE,rRESERVED,rIRESERVED,rORESERVED};
  123.  
  124. //
  125. // MACROS
  126. //
  127.  
  128. #define fileErrorTest(x)    \
  129. {\
  130.     if((x)<=0)\
  131.         fatalError("File Error Reading/Writing");\
  132. }
  133. #define AINFEQU(x,y)        \
  134. ((x.in0 == y.in0)&&(x.vol0 == y.vol0)&&\
  135.  (x.in1 == y.in1)&&(x.vol1 == y.vol1)&&\
  136.  (x.in2 == y.in2)&&(x.vol2 == y.vol2)&&\
  137.  (x.in3  == y.in3)&&(x.vol3 == y.vol3))
  138. #define EXOR(x,y)           (((x) && !(y))||((!x) && (y)))
  139. extern char * szTesting;
  140. #define StatusTest(a,b,c)   \
  141. {\
  142.     if(fVerbose) Msg(c,szTesting,""); \
  143.     a=b; \
  144.     if (fVerbose) InterpStatus(a); \
  145.  
  146. // 
  147. // Definitions for Audio track control parameters
  148. // 
  149.  
  150. #define   TWO_AUD_NOPRE    0xD0
  151. #define   TWO_AUD_PRE      0x10
  152. #define   FOUR_AUD_NOPRE   0x80
  153. #define   FOUR_AUD_PRE     0x90
  154. #define   DATA_TRACK       0x40
  155. #define   AUD_RESERVED     0xF0
  156. #define   DIG_COPY_PROHI   0x0
  157. #define   DIG_COPY_PERM    0x0
  158.  
  159. //
  160. // function prototypes
  161. //
  162.  
  163. #include"rstruct.h"
  164. #include"proto.h"
  165. #include "message.h"
  166.